import random

def generate_grades(num_students=20):
    """
    随机生成指定数量学生的成绩，并判断成绩等级。
    
    参数:
    num_students (int): 学生数量，默认值为 20

    返回:
    dict: 学生成绩和对应等级的字典
    """
    grades = {}
    
    for i in range(1, num_students + 1):
        score = random.randint(0, 100)  # 随机生成 0 到 100 之间的成绩
        if score >= 90:
            grade = 'A'
        elif 80 <= score < 90:
            grade = 'B'
        elif 70 <= score < 80:
            grade = 'C'
        else:
            grade = 'D'
        
        grades[f"Student_{i}"] = (score, grade)
    
    return grades

# 运行示例
result = generate_grades()
for student, (score, grade) in result.items():
    print(f"{student}: 成绩={score}, 等级={grade}")
